//
// Created by xili on 2024/8/27 19:11.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int numSubarrayProductLessThanK(vector<int> &nums, int k) {
        int n = nums.size();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int sum = 1;
            for (int j = i; j < n; j++) {
                sum *= nums[j];
                if (sum >= k) {
                    break;
                }
                ans++;
            }
        }
        return ans;
    }
};